#include <stdio.h>
#include <stdlib.h>
#include <csp_spu.h>
#include <csp_debug.h>
#include "../../shared/poison_test.h"


int global_pid; 


int Run(){
	int pid = csp_pid();


	global_pid = csp_pid();

	int n __attribute__ ((aligned(16)));
	int poison = 0;

	n = 42;

	csp_channel gang2collector = 
		csp_create_channel(ANY2ONE_CHANNEL, GANG_CHANNEL, sizeof(int));

	poison = csp_channel_write(gang2collector, &n);

	ASSERT( CHANNEL_POISON == poison );

	poison = csp_channel_write(gang2collector, &n);

	ASSERT( CHANNEL_POISON == poison );


	ASSERT( pid == csp_pid() );
	ASSERT( global_pid == csp_pid() );

	printf("poison_w_gang_process terminating.\n");


	return GANG_RET_STATUS;
}
